#include <iostream>
#include <string>
#include <sstream>
#include <ctime>    // For time()
#include <cstdlib>  // For srand() and rand()

using namespace std;

string switcher(string tmp, int random)
{
	string returnString;
	int r;
	int caseTest = 0;
	if (tmp == string("NP"))
		caseTest = 1;
	else if (tmp == string("VP"))
		caseTest = 2;
	else if (tmp == string("N"))
		caseTest = 3;
	else if (tmp == string("ADJ"))
		caseTest = 4;
	else if (tmp == string("V"))
		caseTest = 5;
	else //ADV
		caseTest = 6;

	switch(caseTest)
	{

	case 1 :
		r = random%2;
		if (r == 0)
		{
			returnString.append(switcher(string("N"), rand()));
		}
		else
		{
			returnString.append(switcher(string("NP"), rand()));
			returnString.append(switcher(string("ADJ"), rand()));
		}
		break;
	case 2 :
		r = random%2;
		if (r == 0)
		{
			returnString.append(switcher(string("V"), rand()));
		}
		else
		{
			returnString.append(switcher(string("V"), rand()));
			returnString.append(switcher(string("ADV"), rand()));
		}
		break;
	case 3 :
		r = random % 5;
		if (r == 0)
			return string(" dog");
		else if (r == 1)
			return string(" cat");
		else if (r == 2)
			return string(" professor");
		else if (r == 3)
			return string(" student");
		else
			return string(" rat");
		break;
	case 4 :
		r = random % 4;
		if (r == 0)
			return string(" ran");
		else if (r == 1)
			return string(" ate");
		else if (r == 2)
			return string(" slept");
		else
			return string(" drank");
		break;
	case 5 :
		r = random % 3;
		if (r == 0)
			return string(" red");
		else if (r == 1)
			return string(" slow");
		else
			return string(" dead");
		break;
	case 6 :
		r = random % 3;
		if (r == 0)
			return string(" quickly");
		else if (r == 1)
			return string(" happily");
		else
			return string(" well");
		break;
	}
	return returnString;
};

int main()
{
	srand(time(0));
	string randomString = "the";
	randomString.append(switcher(string("NP"), rand()));
	randomString.append(switcher(string("VP"), rand()));
	cout << randomString;
	cin.get();
	return 0;
}